/**
 * Created by BoTong on 2017/12/20.
 */
import Vue from 'vue'
require("../../API/config")
export default {
    // 查询公告列表
    getapinoticenoticeindex({ }, postdata) {
        var ipstr = global.getapinoticenoticeindexPath
        return Vue.http.post(ipstr, postdata).then(response => {
            if (response.status === 200) {
                return Promise.resolve(response.body)
            } else {
                return Promise.reject(response.data.message)
            }
        })
    },
    // 删除公告列表
    getnoticedelete({ }, postdata) {
        var ipstr = global.getnoticedeletePath
        return Vue.http.post(ipstr, postdata).then(response => {
            if (response.status === 200) {
                return Promise.resolve(response.body)
            } else {
                return Promise.reject(response.data.message)
            }
        })
    },
    // 上传图片
    uploadFile({ }, postdata) {
        var ipstr = global.uploadFilePath
        return Vue.http.post(ipstr, postdata).then(response => {
            if (response.status === 200) {
                return Promise.resolve(response.body)
            } else {
                return Promise.reject(response.data.message)
            }
        })
    },
    // 获取部门树结构
    getdeptstaff({ }, postdata) {
        var ipstr = global.getdeptstaffPath + '/' + postdata.oid + '/' + postdata.uid
        return Vue.http.post(ipstr, postdata).then(response => {
            if (response.status === 200) {
                return Promise.resolve(response.body)
            } else {
                return Promise.reject(response.data.message)
            }
        })
    },
    // 发送公告
    getnoticesave({ }, postdata) {
        var ipstr = global.getnoticesavePath
        return Vue.http.post(ipstr, postdata).then(response => {
            if (response.status === 200) {
                return Promise.resolve(response.body)
            } else {
                return Promise.reject(response.data.message)
            }
        })
    },
    // 公告详情
    getnoticeinfo({ }, postdata) {
        var ipstr = global.getnoticeinfoPath
        return Vue.http.post(ipstr, postdata).then(response => {
            if (response.status === 200) {
                return Promise.resolve(response.body)
            } else {
                return Promise.reject(response.data.message)
            }
        })
    },
    // 收藏公告
    getusercolladdnc({ }, postdata) {
        var ipstr = global.getusercolladdncPath
        return Vue.http.post(ipstr, postdata).then(response => {
            if (response.status === 200) {
                return Promise.resolve(response.body)
            } else {
                return Promise.reject(response.data.message)
            }
        })
    },
    // 判断是否是管理员
    getapiIndex({ }, postdata) {
        var ipstr = global.getapiIndexPath + '/' + postdata.oid
        return Vue.http.post(ipstr, postdata).then(response => {
            if (response.status === 200) {
                return Promise.resolve(response.body)
            } else {
                return Promise.reject(response.data.message)
            }
        })
    },
}
